<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>晒羊毛-撸羊毛有风险，投资需谨慎</title>
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/bootstrap.min.css"></head>
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/style.min.css"></head>
	<link rel="stylesheet" type="text/css" href="<%=path%>/js/plugins/datapicker/datepicker3.css"></head>
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css"></head>
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/sym.css"></head>
	<script type="text/javascript" src="<%=path%>/js/jquery.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<script type="text/javascript" src="<%=path%>/js/layer/layer.js"></script>
	<script type="text/javascript" src="<%=path%>/js/common.js"></script>

<body class="gray-bg">
<jsp:include page="/views/commons/header.jsp"></jsp:include>

<div class="layout ">
	<div class="mb20">
		<div class="hbox">
			<div class="hd">
				<h3>发布活动</h3>
			</div>
			<div class="bd clearfix">
				<form class="form-horizontal activity_box" id="activity_form" action="javascript:insertActivity()">
					<input type="hidden" name="activityId" value="${activity.activityId}">
					<div class="form-group">
						<label class="col-sm-2 control-label">平台名：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" name="platformName"  value="${activity.platformName}" placeholder="请填写您要发布的平台名"></div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">活动名称：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" name="activityName"  value="${activity.activityName}" placeholder="请填写您要发布的活动名称"></div>
					</div>
					<div class="form-group" id="data_5">
						<label class="col-sm-2 control-label">活动时间：</label>
						<div class="col-sm-10">
							<div id="datepicker" class="input-daterange input-group">
								<input type="text"  name="activityBeginTime"  value="<fmt:formatDate value='${activity.activityBeginTime}' pattern='yyyy-MM-dd'/>" class="input-sm form-control">
								<span class="input-group-addon">到</span>
								<input type="text"  name="activityEndTime"  value="<fmt:formatDate value='${activity.activityEndTime}' pattern='yyyy-MM-dd'/>" class="input-sm form-control">
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">网址：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" name="activityUrl"  value="${activity.activityUrl}" placeholder="活动链接"></div>
					</div>

					<div class="col-md-12 text-warning text-center">* 以下为必选项--单选</div>
					<d:radio describe="投资金额:" tableColumn="invest_money_range" fieldName="investMoneyRange" value="${activity.investMoneyRange}"></d:radio>
					<d:radio describe="活动奖励:" tableColumn="reward_range" fieldName="rewardRange" value="${activity.rewardRange}"></d:radio>
					<d:radio describe="投资期限:" tableColumn="period_range" fieldName="periodRange" value="${activity.periodRange}"></d:radio>
					<d:radio describe="平台背景:" tableColumn="platform_background" fieldName="platformBackground" value="${activity.platformBackground}"></d:radio>
					<d:radio describe="运营时间:" tableColumn="operation_time_range" fieldName="operationTimeRange" value="${activity.operationTimeRange}"></d:radio>
				
					<div class="form-group">
						<label class="col-sm-2 control-label">活动详情:</label>
						<div class="col-sm-10">
							<textarea name="activityDetail" style="width:100%;height:400px;visibility:hidden;">
							<fns:encodes value="${activity.activityDetail}" type="4"/>
							</textarea>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-10 col-sm-offset-2">
							<button id="activity_confirm_btn" class="btn btn-primary">提交</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<jsp:include page="/views/commons/footer.jsp"></jsp:include>

<link rel="stylesheet" href="<%=path%>/js/plugins/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="<%=path%>/js/plugins/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="<%=path%>/js/plugins/kindeditor/lang/zh_CN.js"></script>

<script type="text/javascript">
	$(function() {
		var editor;
		KindEditor.ready(function(K) {
			editor = K.create('textarea[name="activityDetail"]', {
				allowFileManager: false,
				allowUpload : true,
				uploadJson:"<%=path %>/uncheck/pictures/upload/json",
				items : [
				         'source', '|', 'undo', 'redo', '|', 'preview',  'template', 'cut', 'copy', 'paste',
				         'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
				         'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
				         'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
				         'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
				         'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'table', 'hr', 
				         'emoticons', 'baidumap', 'pagebreak','anchor', 'link', 'unlink', '|', 'about'
				 ]
			});
		});
		$("#data_5 .input-daterange").datepicker({
			keyboardNavigation: !1,
			forceParse: !1,
			autoclose: !0
		})
	})
	
	function insertActivity(){
		$("#activity_confirm_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
		$.ajax({
			url : path + "/check/activity/update",
			type : "post",
			dataType : "json",
			data : $("#activity_form").serialize(),
			success : function(data)
			{
				if(data.result){
					layer.msg("发布成功",{icon: 1});
					window.location.href=path + "/views/activity/activity_list.jsp";
				}else{
					layer.msg(data.message,{icon: 2});
					$("#activity_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
				}
			},error:function(){
				layer.msg("服务器网络繁忙",{icon: 2});
				$("#activity_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
			}
		});
	}
	</script>
</body>
</html>